<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>

    function Fn(m){
        this.msg = m;
    }
    Fn.prototype.show = function(){
        console.log(this.msg);
    }

    const f = new Fn("hello")
    console.log(f);
    console.log(f.msg);
    f.show();

    console.log("=======");

    class Fun{
        constructor(m){
            // 等同于老语法的构造函数部分
            this.msg = m;
        };
        // 等同于老语法的原型部分
        show(){
            console.log(this.msg)
        }
    }
    const f2 = new Fun("world")
    console.log(f2);
    console.log(f2.msg);
    f2.show();

    console.log("=======");

    // function Test(){}
    // Test.prototype.xxx = function(){}

    // class Test{
    //     show(){}
    // }

    
</script>
</html>